package com.example.apidocserver.domain.document.dto;

import com.example.apidocserver.domain.document.entity.ApiParamField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.List;

/**
 * 参数说明字段dto
 *
 * @author xyqlg
 */
@Data
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class RltFieldUpsertDto {
    public RltFieldUpsertDto(int size) {
        updateFieldList = new ArrayList<>(size);
        createFieldList = new ArrayList<>(size);
        deleteRltList = new ArrayList<>(size);
        updateRltList = new ArrayList<>(size);
        addRltList = new ArrayList<>(size);
    }

    /**
     * 新增、修改字段
     */
    private List<ApiParamField> updateFieldList;

    /**
     * 加字段
     */
    private List<ApiParamField> createFieldList;

    /**
     * 删除关系字段
     */
    private List<ApiParamField> deleteRltList;

    /**
     * 修改关系字段
     */
    private List<ApiParamField> updateRltList;

    /**
     * 增加修改字段
     */
    private List<ApiParamField> addRltList;

    /**
     * 修改字段说明增加
     *
     * @param field 字段说明对象
     */
    public void putUpdateField(ApiParamField field) {
        this.updateFieldList.add(field);
    }

    /**
     * 修改字段说明增加
     *
     * @param field 字段说明对象
     */
    public void putCreateField(ApiParamField field) {
        this.updateFieldList.add(field);
    }
}
